package com.xing.controller;

import com.woniuxy.entity.Product;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: 曾令忠
 * @Description:
 * @Date: 2020/7/8 0008-下午 4:22
 */
@Controller
@RequestMapping("/product")
public class ProductController {
    @Value("${server.port}")
    Integer port;

    @RequestMapping("/get")
    @ResponseBody
    public Map getInfo(int id){
        Product product = new Product();
        product.setPid(id);
        product.setPname("中国地图");
        product.setStock(900);
        Map map = new HashMap();
        map.put("data",product);
        map.put("code",200);
        map.put("port",port);
        return  map;

    }
}
